<?php
namespace App\Api;

use PhalApi\Api;
use App\Domain\Appfc114\Project as DomainProject;

/**
 * 默认接口服务类
 *
 * @author: dogstar <chanzonghuang@gmail.com> 2014-10-04
 */

class Site extends Api {

	public function getRules() {
        return array(
            'index' => array(
                'username' 	=> array('name' => 'username', 'default' => '飘渺Dk!'),
            ),
            'navList' => array(),
            'swiperList'=>array()
        );
	}
	
	/**
	 * 默认接口服务
     * @desc 默认接口服务，当未指定接口服务时执行此接口服务
	 * @return string title 标题
	 * @return string content 内容
	 * @return string version 版本，格式：X.X.X
	 * @return int time 当前时间戳
	 */
	public function index() {
        return array(
            'title' => 'Hello ' . $this->username,
            'version' => PHALAPI_VERSION,
            'time' => $_SERVER['REQUEST_TIME'],
        );
	}

	/**
     * 首页导航
     */
    public function navList(){
        $data = array(
            array('title'=>'新房分销','type'=>2,'color'=>'#fc5957','value'=>'aicon_newhouse.png','way'=>'switchTab',
                'url'=>'/pages/newhouse/list','param'=>'is_boss'),
            array('title'=>'垫资赎楼','type'=>2,'color'=>'#2196F3','value'=>'aicon_loans.png','way'=>'webview',
                'url'=>'https://mp.weixin.qq.com/s/WA3W0MI435P6ZDz1O_Vecg'),
            array('title'=>'门店SaaS系统','type'=>2,'color'=>'#fc5957','value'=>'aicon_saas.png','way'=>'navigator',
                'url'=>'/pages/service/service?type=saas'),
            array('title'=>'二手房行情','type'=>2,'color'=>'#2196F3','value'=>'aicon_esf.png','way'=>'switchTab',
                'url'=>'/pages/news/news','param'=>'news'),
//            array('title'=>'热门楼盘','type'=>1,'color'=>'#fc5957','value'=>'52','url'=>''),
//            array('title'=>'即将取证','type'=>1,'color'=>'#2dcb71','value'=>'76','url'=>''),
//            array('title'=>'最新取证','type'=>1,'color'=>'#f08618','value'=>'20','url'=>''),
//            array('title'=>'最新摇号','type'=>1,'color'=>'#8f5ca1','value'=>'10','url'=>''),
//            //array('title'=>'摇号剩余','type'=>1,'color'=>'#2196F3','value'=>'10','url'=>''),
//
//            array('title'=>'新房分销','type'=>2,'color'=>'#fc5957','value'=>'icon_project.png','url'=>''),
//            array('title'=>'不限购','type'=>2,'color'=>'#2dcb71','value'=>'icon_stop.png','url'=>''),
//            array('title'=>'商办','type'=>2,'color'=>'#f08618','value'=>'icon_office.png','url'=>''),
//            array('title'=>'别墅','type'=>2,'color'=>'#8f5ca1','value'=>'icon_house.png','url'=>''),
//
//            array('title'=>'公寓','type'=>2,'color'=>'#8f5ca1','value'=>'icon_apartment.png','url'=>''),
//            array('title'=>'房产数据','type'=>2,'color'=>'#8f5ca1','value'=>'icon_data.png','url'=>''),
//            array('title'=>'资格查询','type'=>2,'color'=>'#8f5ca1','value'=>'icon_search.png','url'=>''),
//            array('title'=>'房贷计算','type'=>2,'color'=>'#8f5ca1','value'=>'icon_calculator.png','url'=>''),
//
//            array('title'=>'地图找房','type'=>2,'color'=>'#2196F3','value'=>'icon_map.png','url'=>''),
//            array('title'=>'楼市资讯','type'=>2,'color'=>'#2196F3','value'=>'icon_information.png','url'=>''),
//            array('title'=>'垫资赎楼','type'=>2,'color'=>'#2196F3','value'=>'icon_buyback.png','url'=>''),
//            array('title'=>'办公租赁','type'=>2,'color'=>'#2196F3','value'=>'icon_rent.png','url'=>'')
        );
        //$rlt = array('data'=>$data,'code'=>200,'msg'=>'成功');
        return $data;
    }

    /**
     * 首页轮播
     */
    public function SwiperList(){
        $data['adv'] = array(
            array('img_url'=>'/upload/image/adv_loans.jpg','type'=>'link','url'=>'/pages/index/webview?url=https://mp.weixin.qq.com/s/WA3W0MI435P6ZDz1O_Vecg')
        );
        $data['swiper'] = array(
            array('img_url'=>'/upload/tmp/del3.png','type'=>'link','url'=>'/pages/service/service?type=saas'),
            array('img_url'=>'/upload/tmp/del2.png','type'=>'link','url'=>'/pages/newhouse/detail?id=5208'),
        );
/*
        $Project = new DomainProject();
        $info = $Project->getlist();
        foreach ($info as $key=>$item){
            if($item['img_url']!='') {
                $data[$key]['id'] = $item['id'];
                $data[$key]['img_url'] = $item['img_url'];
                $data[$key]['type'] = 'project';
            }
        }
*/
        return $data;
    }
}
